<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>投稿</title>
</head>
<body>
<form method="post" action="upload" enctype="multipart/form-data">
    选择一个文件:
    <input type="file" name="uploadFileImage" onchange="viewImage(this)"/>
    <br/><br/>
    <input type="hidden" name ="op" value="upload">
    <input type="submit" value="上传" />
</form>



<div class="form-group" id="caseIma">
		<label class="control-label">案例图片</label> <label
			class="btn btn-primary">选择图片 <input type="file"
			style="display: none" class="form-control" id="caseImage"
			name="caseImage"  />
		</label> !--
		<p class="help-block">建议尺寸88*88</p>
		-->
	</div>
	<div id="localImag">
		<img id="preview" width=30% height=25% style="diplay: none" />
	</div>
	<script type="text/javascript">
		//上传图片后预览图片
		function viewImage(file) {
			var preview = document.getElementById('preview');
			if (file.files && file.files[0]) {
				//火狐下
				preview.style.display = "block";
	
				preview.src = window.URL.createObjectURL(file.files[0]);
			} else {
				//ie下，使用滤镜
				file.select();
				var imgSrc = document.selection.createRange().text;
				var localImagId = document.getElementById("localImag");
				//必须设置初始大小 
				localImagId.style.width = "400px";
				localImagId.style.height = "300px";
				try {
					localImagId.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)";
					locem("DXImageTransform.Microsoft.AlphaImageLoader").src = imgSrc;
				} catch (e) {
					alert("您上传的图片格式不正确，请重新选择!");
					return false;
				}	
			}
			return true;
		}
	</script>
</body>
</html>